import urllib
from urllib import request

# 下载图片
# url = "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fc-ssl.duitang.com%2Fuploads%2Fblog%2F202106%2F28%2F20210628204020_17863.thumb.1000_0.jpg&refer=http%3A%2F%2Fc-ssl.duitang.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1664070060&t=53e9dbba2db474ee649fc54d2c85a551"

# 通过request请求对于的url 获得返回结果
# request.urlretrieve(url,'1000_0.png')

# 下载视频

# url = "https://vd4.bdstatic.com/mda-nhjektharfg6asm9/sc/cae_h264/1661044842509758716/mda-nhjektharfg6asm9.mp4?v_from_s=hkapp-haokan-hbf&auth_key=1661480296-0-0-5d921bf058321d204688a9ab49b0c1bd&bcevod_channel=searchbox_feed&cd=0&pd=1&pt=3&logid=2896215402&vid=10007056871043577295&abtest=103525_1-103579_2&klogid=2896215402"
# request.urlretrieve(url,'1000_0.mp4')

# 对返回结果进行读取，并对读取结果进行转换
# print(response.read().decode('utf8'))


url = 'http://www.baidu.com'
request.urlretrieve(url,'baidu.html')




